<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
<div>
	<p>
		<span id="sun">太阳</span>当空照
	</p>
</div>
<script type="text/javascript">
	let sun = document.getElementById("sun")
	//获取span的父元素节点 parentNode
	let p = sun.parentNode
	console.log(p)

	let div = p.parentNode
	let div2 = sun.parentNode.parentNode
	console.log(div,div2)

	sun.parentNode.parentNode.parentNode.style.background = 'pink'
</script>
</body>
</html>